<template>
    <!--建档资料维护模块  营销员事项页面-->
    <div class="baseInfoPage">
         <el-form :rules="rules" label-width="120px" class="search_container">
            <el-row class="mt10">
                    <el-col :span="8">
                        <el-form-item label="营销员所属机构" prop="acceptNo">
                            <el-col :span="12" class="pr10"><el-input disabled v-model="euaa.agntcoy"  placeholder=""></el-input></el-col>
                            <el-col :span="12"><el-input disabled v-model="euaa.cntbranch" placeholder=""></el-input></el-col>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                     <el-col :span="8">
                        <el-form-item label="营销员一" prop="acceptNo">
                            <el-row>
                                <el-col :span="8">
                                    <el-input :disabled="flag =='N'"  v-model="euaa.zrsecno01" @change="checkEuaapkyZrsecno01"></el-input>
                                </el-col>
                                <el-col :span="8">
                                    <el-input :disabled="flag =='N'"  v-model="euaa.agntname01"></el-input>
                                </el-col>
                                <el-col :span="8">
                                    <el-input :disabled="flag =='N'"  v-model="euaa.agtydesc01"></el-input>
                                </el-col>
                            </el-row>
                        </el-form-item>
                    </el-col>
                     <el-col :span="6">
                        <el-form-item label="签名" prop="acceptNo">
                            <el-select :disabled="flag =='N'"  v-model="euaa.sign"  placeholder="请选择" >
                                <el-option
                                    v-for="item in yorn"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="佣金率一" prop="acceptNo">
                            <el-input-number :disabled="flag =='N'"  v-model="euaa.agcomrt01" :min="0"
                                :precision="2" :step="0.1" controls-position="right" />
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                     <el-col :span="8">
                        <el-form-item label="营销员二" prop="acceptNo">
                             <el-row>
                                <el-col :span="8">
                                    <el-input  :disabled="flag =='N'" v-model="euaa.zrsecno02" @change="checkEuaapkyZrsecno02"></el-input>
                                </el-col>
                                <el-col :span="8">
                                    <el-input  :disabled="flag =='N'" v-model="euaa.agntname02"></el-input>
                                </el-col>
                                <el-col :span="8">
                                    <el-input :disabled="flag =='N'"  v-model="euaa.agtydesc02"></el-input>
                                </el-col>
                            </el-row>
                        </el-form-item>
                    </el-col>
                     <el-col :span="6">
                        <el-form-item label="签名" prop="acceptNo">
                            <el-select :disabled="flag =='N'"  v-model="euaa.tsign"  placeholder="请选择" >
                                <el-option
                                    v-for="item in yorn"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="佣金率二" prop="acceptNo">
                            <el-input-number :disabled="flag =='N'"  v-model="euaa.agcomrt02" :min="0"
                                :precision="2" :step="0.1" controls-position="right" />
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row class="common-box">
                    <el-col :span="10">
                        <el-col :span="7" class="common-lab">
                            <label class="labelName">销售人员</label>
                        </el-col>
                         <el-col :span="17" class="pl5">
                            <el-input  :disabled="flag =='N'" v-model="agentmatter.salesman" placeholder=""></el-input>
                         </el-col>
                    </el-col>
                     <el-col :span="2">&nbsp;</el-col>
                    <el-col :span="10">
                         <el-col :span="7" class="common-lab">
                            <label class="labelName">销售人员姓名是否正确</label>
                        </el-col>
                         <el-col :span="17">
                             <el-select :disabled="flag =='N'"  v-model="agentmatter.isSalesmanName"  placeholder="请选择" >
                                <el-option
                                    v-for="item in isSalesmanName"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                    </el-col>
                </el-row>

                <el-row class="common-box">
                     <el-col :span="10">
                        <el-col :span="7" class="common-lab">
                            <label class="labelName">亲晤投保人…投保书上签名</label>
                        </el-col>
                         <el-col :span="17" class="pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.isApplSign"  placeholder="请选择" >
                                <el-option
                                    v-for="item in sorf"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                    </el-col>
                     <el-col :span="2">&nbsp;</el-col>
                    <el-col :span="10">
                        <el-col :span="7" class="common-lab">
                            <label class="labelName">营销员报告书的鉴定方式</label>
                        </el-col>
                        <el-col :span="6" class="pr10">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.saleRepIm"  placeholder="请选择" >
                                <el-option
                                    v-for="item in saleRepIms"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                         <el-col :span="11">
                             <el-input :disabled="flag =='N'"  v-model="agentmatter.saleRepImInfo"  placeholder=""></el-input>
                         </el-col>
                    </el-col>
                </el-row>

                <el-row class="common-box">
                    <el-col :span="10" >
                        <el-col :span="7" class="common-lab">
                            <label class="labelName">投保目的</label>
                        </el-col>
                        <el-col :span="8" class="pr10 pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.insuPur"  placeholder="请选择" >
                                <el-option
                                    v-for="item in insuPurs"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                         <el-col :span="9">
                             <el-input :disabled="flag =='N'"  v-model="agentmatter.insuPurInfo" placeholder=""></el-input>
                         </el-col>
                    </el-col>
                    <el-col :span="8" >
                        <el-col :span="9" class="common-lab">
                            <label class="labelName">投保人或被保人有…贷款</label>
                        </el-col>
                        <el-col :span="15" class="pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.appOrInsuHasLoan" placeholder="请选择" >
                                <el-option
                                    v-for="item in sorf"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                    </el-col>
                    <el-col :span="6">
                        <el-col :span="8" class="common-lab">
                            <label class="labelName">总金额</label>
                        </el-col>
                        <el-col :span="16">
                            <el-input-number :disabled="flag =='N'"  v-model="agentmatter.totalAmt" :min="0"
                                :precision="2" :step="0.1" controls-position="right" />
                         </el-col>
                    </el-col>
                </el-row>

                <el-row class="common-box">
                     <el-col :span="10">
                        <el-col :span="7" class="common-lab">
                            <label class="labelName">被保人有…其他疾病</label>
                        </el-col>
                         <el-col :span="17" class="pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.insuHasOthDisease"  placeholder="请选择" >
                                <el-option
                                    v-for="item in sorf"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                    </el-col>
                    <el-col :span="8">
                        <el-col :span="9" class="common-lab">
                            <label class="labelName">详述</label>
                        </el-col>
                         <el-col :span="15" class="pl5">
                             <el-input :disabled="flag =='N'"  v-model="agentmatter.othDiseaseInfo"  placeholder=""></el-input>
                         </el-col>
                    </el-col>
                </el-row>

                 <el-row class="common-box">
                    <el-col :span="10" >
                        <el-col :span="7" class="common-lab">
                            <label class="labelName">被保人有…其他特殊嗜好</label>
                        </el-col>
                        <el-col :span="6" class="pr10 pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.insuHasOthSpecHobby" placeholder="请选择" >
                                <el-option
                                    v-for="item in sorf"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                         <el-col :span="11">
                             <el-input  :disabled="flag =='N'"  v-model="agentmatter.othSpcHobbyInfo" placeholder=""></el-input>
                         </el-col>
                    </el-col>
                    <el-col :span="7" >
                        <el-col :span="10" class="common-lab">
                            <label class="labelName">投保书签署地</label>
                        </el-col>
                        <el-col :span="14" class="pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.applSignPlace"  placeholder="请选择" >
                                <el-option value="" label="" />
                                <el-option
                                    v-for="item in cityList"
                                    :key="item.citycode"
                                    :label="item.citydesc"
                                    :value="item.citycode">
                                </el-option>
                            </el-select>
                         </el-col>
                    </el-col>
                    <el-col :span="7" >
                        <el-col :span="10" class="common-lab">
                            <label class="labelName">营销员确认签署地</label>
                        </el-col>
                        <el-col :span="14" class="pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.saleSignPlace"  placeholder="请选择" >
                                <el-option value="" label="" />
                                <el-option
                                    v-for="item in cityList"
                                    :key="item.citycode"
                                    :label="item.citydesc"
                                    :value="item.citycode">
                                </el-option>
                            </el-select>
                         </el-col>
                    </el-col>
                 </el-row>
                 <el-row>
                    <el-col :span="9" >
                        <el-col :span="8" class="common-lab">
                            <label class="labelName">出入境证明复印件与原件相符</label>
                        </el-col>
                        <el-col :span="16" class="pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.isCopyConsistentOri"  placeholder="请选择" >
                                <el-option
                                    v-for="item in sorf"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                    </el-col>
                    <el-col :span="9" >
                        <el-col :span="10" class="common-lab">
                            <label class="labelName">房屋贷款</label>
                        </el-col>
                        <el-col :span="14" class="pl5">
                            <el-select :disabled="flag =='N'"  v-model="agentmatter.houseLoan"  placeholder="请选择" >
                                <el-option
                                    v-for="item in sorf"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                         </el-col>
                    </el-col>
                 </el-row>
        </el-form>

    </div>
</template>
<script>
    import { getAddressBySorgpf,checkEuaapkyZrsecno01,checkEuaapkyZrsecno02 } from "@/api/policyRecord/materialsMaintain/insurance.js";
    import constant from '@/utils/constant';
    export default {
        data(){
            return {
                  value:'',
                  euaa: {},
                  agentmatter: {},
                  yorn: [{value:'N',label:'N'},{value:'Y',label:'Y'}],
                  sorf: [{value:'',label:''},{value:'Y',label:'是'},{value:'N',label:'否'}],
                  isSalesmanName: [{value:'',label:''},{value:'0',label:'正常'},
                                   {value:'1',label:'漏填'},{value:'2',label:'模糊不清'}],   
                  saleRepIms: [
                      {value:'',label:''},{value:'1',label:'陌生拜访'},{value:'2',label:'原已相识'},
                      {value:'3',label:'朋友/保户介绍'},{value:'4',label:'投保人/被保人主动要求'},
                      {value:'5',label:'其他'}
                  ],
                  insuPurs: [
                      {value:'',label:''},
                      {value:'1',label:'未来生活保障'},{value:'2',label:'储蓄'},
                      {value:'3',label:'子女教育经费'},{value:'4',label:'节税'},
                      {value:'5',label:'房屋按揭'},{value:'6',label:'其他'}
                  ],
                  rules: {},
                  insureDataForm: this.insureData,
                  cityList: [],
            }
        },
        props:{
			flag:{
				type:String
			},
            insureData:{
                type: Object,
            },
            getChildrenData: {
                type: Function,
                default: null,
            },
        },
        mounted(){
            this.reloadInsureData(null);
            this.getAddressBySorgpf();
        },
        methods: {
            reloadInsureData(insureData){
                if(insureData != null){
                    this.insureDataForm = insureData;
                }
                this.euaa = this.insureDataForm.euaa;
                this.agentmatter = this.insureDataForm.agentmatter;
            },
            getInsureData(){
                return this.insureData;
            },
            getAddressBySorgpf(){
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let para = {};
                getAddressBySorgpf(para).then(res =>{
                    if(res.resultCode == constant.SUCCESS){
                        this.cityList = res.data;
                        this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                    }
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            },
            checkEuaapkyZrsecno01(){
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let formData = this.getChildrenData();
                let para = { 
                    zrsecno01: this.euaa.zrsecno01,
                    euabList: formData.euabs
                };
                checkEuaapkyZrsecno01(para).then(res => {
                    if(res.resultCode == constant.SUCCESS){
                        this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                        let data = res.data;
                        if(data != null){
                            this.euaa.agntname01 = data.euaapkyForm_agntname01;
                            this.euaa.flag07 = data.euaapkyForm_flag07;
                            this.euaa.tsalesdsc = data.euaapkyForm_tsalesdsc;
                            this.euaa.agcomrt01 = data.euaapkyForm_agcomrt01;
                            this.euaa.agntcoy = data.euaapkyForm_agntcoy;
                            this.euaa.tsalesunt = data.euaapkyForm_tsalesunt;
                            this.euaa.agntnum01 = data.euaapkyForm_agntnum01;
                            this.euaa.flag01 = data.euaapkyForm_flag01;
                            this.euaa.agtydesc01 = data.euaapkyForm_agtydesc01;
                            this.euaa.agentClass01 = data.euaapkyForm_agentClass01;
                            if(data.info != undefined){
                                this.$message({
                                    message: data.info,
                                    type: 'error'
                                });
                            }
                        }
                    }
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            },
            checkEuaapkyZrsecno02(){
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let formData = this.getChildrenData();
                let para = { 
                    zrsecno02: this.euaa.zrsecno02,
                    euabList: formData.euabs,
                    agntcoy1: this.euaa.agntcoy
                };
                checkEuaapkyZrsecno02(para).then(res => {
                    if(res.resultCode == constant.SUCCESS){
                        this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                        let data = res.data;
                        this.euaa.flag07 = data.euaapkyForm_flag07;
                        this.euaa.agntname02 = data.euaapkyForm_agntname02;
                        this.euaa.flag08 = data.euaapkyForm_flag08;
                        this.euaa.agentClass02 = data.euaapkyForm_agentClass02;
                        this.euaa.agtydesc02 = data.euaapkyForm_agtydesc02;
                        this.euaa.agntnum02 = data.euaapkyForm_agntnum02;
                        this.euaa.flag02 = data.euaapkyForm_flag02;
                        if(data != null){    
                            if(data.info != undefined){
                                this.$message({
                                    message: data.info,
                                    type: 'error'
                                });
                            }
                        }
                    }
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            },
        },
        watch:{
            /**insureDataForm:{
                handler(val, oldVal){
                   if(this.insureDataForm != undefined){
                        this.$emit('updataSalesman', this.insureDataForm)
                    }
                },
                deep:true
            }**/
        }
    }
</script>
<style lang="less" scoped>
.baseInfoPage{
    .common-box{
        padding-bottom: 15px;
    }
    .common-lab{
        line-height:normal!important;
        text-align: right;
        .labelName{
            text-align: right;
        }
    }
}
</style>